#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
#include <vector>

#include "shape.h"
#include "point2.h"
#include "circle3.h"
#include "cylinder.h"

void virtualViaPointer(const Shape *);
void virtualViaReference(const Shape &); 

int main(int argc, char** argv) 
{	

	Point point(7, 11);
	Circle circle(22, 8, 5.2);
	Cylinder cylinder(10, 10, 3.3, 10);
	
	cout << point.getName() << ":";
	point.print();
	cout << "\n";
	
	cout << circle.getName() << ":";
	circle.print();
	cout << "\n";
	
	cout << cylinder.getName() << ":";
	cylinder.print();
	cout << "\n";
	
	vector<Shape *> shapeVector(3);
	shapeVector[0] = &point;
	shapeVector[1] = &circle;
	shapeVector[2] = &cylinder;
	
	for(int i=0; i<shapeVector.size(); i++)
	{
		virtualViaPointer(shapeVector[i]);
	}
	for(int i=0; i<shapeVector.size(); i++)
	{
		virtualViaReference(*shapeVector[i]);
	} 
	return 0;
}
void virtualViaPointer(const Shape *baseClassPtr)
{
	cout << baseClassPtr->getName() << "\n";
	baseClassPtr->print();
	cout << "\n";
	cout << "Area = " << baseClassPtr->getArea() << "\n"
		 << "Volume = " << baseClassPtr->getVolume() << "\n";
}
void virtualViaReference(const Shape &baseClassRef)
{
	cout << baseClassRef.getName() << "\n";
	baseClassRef.print();
	cout << "\n";
	cout << "Area = " << baseClassRef.getArea() << "\n"
		 << "Volume = " << baseClassRef.getVolume() << "\n";
}
